package musicstore.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import musicstore.biz.AlbumBiz;
import musicstore.biz.GenreBiz;
import musicstore.entity.Album;
import musicstore.mapper.AlbumMapper;
import musicstore.mapper.GenreMapper;

@Controller
public class AblumController {
	@Autowired
	private AlbumBiz albumbiz;
	@Autowired
	private GenreBiz genrebiz;
	@RequestMapping("/album-detail")
	public String detail(int id,Model model){
		Album album =albumbiz.fetchById(id);
		model.addAttribute("album",album);
		model.addAttribute("categories", genrebiz.getAll());
		return "album-detail";
	}
}
